<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript" type="text/javascript" src="/card/common/common.js"></script>
<script type="text/javascript" language="javascript"
	src="/card/common/levelone.js"></script>
<script type="text/javascript" language="javascript"
	src="leveltwo.js"></script>	
<script type="text/javascript" language="javascript"
	src="/card/common/level_init.js"></script>
 <title>石家庄一卡通有限公司</title>
<link href="/card/images/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
		/**验证码***/
        .code
        {
            background-image:url(code.jpg);
            font-family:Arial;
            font-style:italic;
            color:Red;
            border:0;
            padding:2px 3px;
            letter-spacing:3px;
            font-weight:bolder;
        }
        .unchanged
        {
            border:0;
        }
</style>
<script type="text/javascript">
	//根据用户选中情况隐藏显示卡号和尾码文本框
	function changeState(flag){
	   var tr = document.getElementById("trCustomerRegister");	   
	   if(flag){
          tr.style.display = "";
	   }else{
		  tr.style.display = "none";
	   }
	}
</script>
</head>

<body>
<table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="/card/images/index_02.jpg" width="945" height="93" /></td>
  </tr>
</table>
<table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><img src="/card/images/index_04.jpg" width="945" height="5" /></td>
  </tr>
</table>
<table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="21"><img src="/card/images/index_06.jpg" width="21" height="32" /></td>
    <td width="903" background="/card/images/index_08.jpg"><div align="center">
    		<script type="text/javascript" language="javascript">
				initLevelOne();
			</script>
    </div></td>
    <td width="21"><img src="/card/images/index_07.jpg" width="21" height="32" /></td>
  </tr>
</table>
<table width="945" height="15" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td></td>
  </tr>
</table>
<table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
		<script type="text/javascript"> 
	 var pic_width=945
 var pic_height=198
 var text_height=0  
 var swfpath = '/card/images/focus.swf' 
 var swf_height = pic_height+text_height 
 var pics='/card/images/q1.jpg|/card/images/q2.jpg|/card/images/q3.jpg|/card/images/q4.jpg'
 var links='#|#|#|#'
 var texts='||'
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ pic_width +'" height="'+ swf_height +'">');document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+swfpath+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');document.write('<param name="menu" value="false"><param name=wmode value="opaque">');document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+pic_width+'&borderheight='+pic_height+'&textheight='+text_height+'">');document.write('<embed src="'+swfpath+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+pic_width+'&borderheight='+pic_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ pic_width +'" height="'+ pic_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>'); </script>
		
		</td>
  </tr>
</table>
<table width="945" height="15" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td></td>
  </tr>
</table>


    <td>&nbsp;</td>
    <td width="668" valign="top">
    <table width="945" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="179" background="/card/images/index_26.jpg"><div align="center" class="baid">会员注册</div></td>
          <td background="/card/images/index_29.jpg">&nbsp;</td>
          <td background="/card/images/index_29.jpg">&nbsp;</td>
          
        </tr>
    </table>
    <form action="add_Merch.action" name="merch" method="post">
      <table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td class="hei" align="right" width="45%">用&nbsp;&nbsp;&nbsp;&nbsp;户：</td><td align="left"  class="hei"><input name="merch.mname" id="mname" type="text" /><font color=red>*</font>（如果注册类型为商户，则为商户名称）          	
          </td>
        </tr>
        <tr>
        <td class="hei" align="right">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td><td align="left" class="hei"> <input type=password name="merch.mpwd" id="merch.mpwd""></input><font color=red>*</font></td>
        <tr>
        <tr id="trCustomerRegister">
	        <td class="hei" align="right">
	        		卡&nbsp;&nbsp;&nbsp;&nbsp;号：
	        </td>
	        <td align="left" class="hei"> 
	        	 <input type=text name="merch.codeno" id="codeno">
	        	 <input type=text name="merch.tailcode" id="merch.tailcode" size="4">(4位尾码)
	        	 </input><font color=red>*</font>	        	 
	        </td>
        <tr>
          <td class="hei" align="right">地&nbsp;&nbsp;&nbsp;&nbsp;址：</td><td align="left" class="hei"> <input type=text name="merch.maddr" id="maddr" ></input><font color=red>*</font></td>
        </tr>
        <tr>
          <td class="hei" align="right">电&nbsp;&nbsp;&nbsp;&nbsp;话：</td><td align="left" class="hei"> <input type=text name="merch.mphone" id="mphone"></input><font color=red>*</font></td>
        </tr>
        <!-- 
         <tr>
          <td class="hei" align="right">描&nbsp;&nbsp;&nbsp;&nbsp;述：</td><td align="left" class="hei"> <input type=text name="merch.mdesc" id="mdesc"></input><font color=red>*</font></td>
        </tr>
        -->
        <tr>
          <td class="hei" align="right">EMAIL：</td><td align="left" class="hei"> <input type=text name="merch.memail" id="email"></input><font color=red>*</font></td>
        </tr>
        <tr>
          <td class="hei" align="right">注册类型：</td>
          <td align="left" class="hei"> 
          	<input type=radio name="regtype" id="t1" onclick="changeState(false)" /> <lable for="t1">商户</lable>
          	<input type=radio name="regtype" id="t2"  checked="checked" onclick="changeState(true)"/> <lable for="t2">卡户</lable>
          </td>
        </tr>
        <tr>
          <td class="hei" align="right">验证码：</td>
          <td align="left" class="hei">
          	<input name="yanzh" type="text" id="yanzh" size="8" onclick="createCode()"  />
								<input type="text"  id="checkCode" class="unchanged" style="width: 80px" readonly />
          </td>
        </tr>        
        <tr>
          <td colspan=2 align="center"><img src="${cardPath}/images/button_02.jpg" width="57" height="20" onclick="regeditMerch()"/></td>
        </tr>
        <tr>
	        <td colspan=2 align="center">
	        	<font color="red" style="font-size:9pt"><s:actionerror/></font>
	        </td>
        </tr>
      </table>
      </form>
     </td>
  </tr>
</table>
<script type="text/javascript">
var code ; //在全局 定义验证码
//生成验证码
function createCode(){ 
		code = "";
		var codeLength = 6;//验证码的长度
		var checkCode = document.getElementById("checkCode");
		var selectChar = 
	  		new Array(0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');//所有候选组成验证码的字符，当然也可以用中文的

		for(var i=0;i<codeLength;i++){
			var charIndex = Math.floor(Math.random()*36);
			code +=selectChar[charIndex];
	    }
		if(checkCode){
		checkCode.className="code";
		checkCode.value = code;
		}  
}

//检查验证码
	function validate (){
		var inputCode = document.getElementById("yanzh").value;
		if(inputCode.length <=0){
		alert("请输入验证码！");
		return false;
		}else if(inputCode != code ){
		alert("验证码输入错误！");
		createCode();//刷新验证码
		return false;
		}else{
		return true;
		}
	}
	
function regeditMerch(){
	var regtype=document.getElementsByName("regtype");
	if(document.getElementById('mname').value.trim()==''){
		alert('用户名称不能为空！');
		document.getElementById('mname').focus();
		return ;
	}
	if(document.getElementById('merch.mpwd').value.trim()==''){
		alert('密码不能为空！');
		document.getElementById('merch.mpwd').focus();
		return ;
	}

	if(regtype[1].checked){
		if(document.getElementById('codeno').value.trim()==''){
			alert('卡号不能为空！');
			document.getElementById('codeno').focus();
			return ;
		}
		if(isNaN(document.getElementById("codeno").value)){
			 alert('卡号只能为数字！');
			 document.getElementById('codeno').focus();
			 return ;
		}
		var txtTailCode = document.getElementById("merch.tailcode");
		//检查尾码是否填写
		if(txtTailCode.value.trim()==''){
			alert('请填写卡号尾码！');
			txtTailCode.focus();
			return;
		}
		//检查尾码的格式是否正确
		if(!/^[a-z0-9A-Z]{4}$/g.test(txtTailCode.value)){
			alert('尾码必须是4位数字和字母的组合！');
			txtTailCode.select();
			return;
		}		
	}
	if(document.getElementById('maddr').value.trim()==''){
		alert('地址不能为空！');
		document.getElementById('maddr').focus();
		return ;
	}
	var phone = document.getElementById('mphone'); 
	if(phone.value.trim() == ''){
		alert('电话不能为空！');
		phone.focus();
		return;
	}
	//电话格式检查
	if((!/^([0-9]{3,4}-)?[0-9]{8}$/g.test(phone.value.trim()))
			&& (!/^[0-9]{11}$/g.test(phone.value.trim()))){
		alert("固定电话的格式必须为【区号-8位有效数字】或【8位有效数字】\n"
				+ "手机电话的格式必须为11位有效数字,请检查！");		
		phone.focus();
		return;
	}		 
	 if(document.getElementById("email").value.indexOf('@')<1){
	     alert('请填写正确的EMAIL！');
		 document.getElementById("email").focus();
		 return ;
	   }
	if(!validate()){
		return;
	}
//卡户
	if(regtype[1].checked){
		var msg = "请再次确认您的卡号及尾码信息，如正确无误请点击[确定]按钮！";
		if(confirm(msg)){
			document.forms["merch"].action="add_Cus.action";
			document.forms["merch"].submit();
		}
		return ;
	 }else{
		var msg = "请再次确认您的注册信息，以确保我们及时与您联系。如正确无误则点击[确认]按钮!";
		if(confirm(msg)){
			alert('商户的注册信息被审核通过后，您可以登录网站修改具体描述！');
			document.forms["merch"].submit();
		}    	
	}
}
</script>
<table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="945" height="69" border="0" align="center" cellpadding="0"
	cellspacing="0" class="bk">
	<tr>
		<td width="25"><img src="${cardPath}/images/yq_35.jpg" width="25"
			height="30" /></td>
		<td width="895" background="${cardPath}/images/yq_07.jpg" class="heic">友情链接</td>
		<td width="25"><img src="${cardPath}/images/yq_36.jpg" width="25"
			height="30" /></td>
	</tr>
	<tr>
		<td height="37">&nbsp;</td>
		<td>
		<jsp:include page="foot.jsp"></jsp:include>
		</td>
		<td>&nbsp;</td>
	</tr>
</table>
<table width="945" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="108" height="105"><div align="center"><img src="images/logo.jpg" width="52" height="64" /></div></td>
    <td width="837"><div align="center" class="di">石家庄一卡通卡有限公司 （2009-2010）版权所有  技术支持:网讯科技 冀ICP备05035382号 <br />
      电话：86－0311－88611099   传真：86－0311－88611099  邮箱:ncckefu@163.com<br />
    地址:石家庄市中山西路83号东方大厦1418室</div></td>
  </tr>
</table>
</body>
</html>
